/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package researchgrants.parts.LoggedData;


/**
 *
 * @author DOStudent1
 */
public class LoggedLogableBoolean implements LoggedLogableObject{

    private String loggedString;
    private boolean isSet=false;
    
    public LoggedLogableObject fromLogableObject(LogableObject myBoolean) {
        LoggedLogableBoolean loggedMyBoolean=new LoggedLogableBoolean();
        if (myBoolean.isEmpty()) {
            loggedMyBoolean.loggedString="";
            loggedMyBoolean.isSet=true;
        } else { 
            boolean bool=((LogableBoolean)myBoolean).getBoolean();
            loggedMyBoolean.loggedString=Boolean.toString(bool);
            loggedMyBoolean.isSet=true;
        }
        return(loggedMyBoolean);
    }
    
    public LogableObject toLogableObject() {
        if (!isSet) {
            throw new RuntimeException("Not initialized");
        }
        Boolean bool=Boolean.parseBoolean(loggedString);
        return(new LogableBoolean().fromBoolean(bool));
    }

    public String toLoggedValue() {
        if (!isSet) {
            throw new RuntimeException("Not initialized");
        }
        return(loggedString);
    }

    public LoggedLogableObject fromLoggedValue(String loggedValue) {
        LoggedLogableBoolean loggedMyObject=new LoggedLogableBoolean();
        loggedMyObject.loggedString=loggedValue;
        loggedMyObject.isSet=true;
        return(loggedMyObject);
    }
}
